package com.web;

import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

import com.domain.Member;
import com.domain.Message;
import com.service.MessageBoardService;

@Controller
@RequestMapping("/messageList*")
public class MessageListController extends AdminController {
	private MessageBoardService messageBoardService;
	
	@Autowired
	public MessageListController(MessageBoardService messageBoardService) {
		this.messageBoardService = messageBoardService;

	}

	@RequestMapping(method = RequestMethod.GET)
	public String generateList(Model model, HttpServletResponse response) {
		List<Message> messages = java.util.Collections.emptyList();
		messages = messageBoardService.listMessages();
		model.addAttribute("messages", messages);
		// response.setHeader("Content-Disposition",
		// "attachment; filename=232.txt" );
		
		return "messageList";
	}

}
